home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Utilities / Siege Watch 2.0 / myAEvents.p < prev    next >
Encoding:
Text File  |  1994-04-23  |  1.9 KB  |  74 lines  |  [TEXT/PJMM]

  1. { Initialize.p functions related to starting up the program }
  2. { translated from Programming for System 7 }
  3. unit MyAppleEvent;
  4. interface
  5.     uses
  6.         AppleEvents, Globals;
  7.     function HandleODoc (theAppleEvent: AppleEvent;
  8.                                     reply: AppleEvent;
  9.                                     myRefCon: LONGINT): OSErr;
  10.     function HandleQuit (theAppleEvent: AppleEvent;
  11.                                     reply: AppleEvent;
  12.                                     myRefCon: LONGINT): OSErr;
  13.  
  14.     function HandlePDOC (theAppleEvent: AppleEvent;
  15.                                     reply: AppleEvent;
  16.                                     myRefCon: LONGINT): OSErr;
  17.     function HandleOApp (theAppleEvent: AppleEvent;
  18.                                     reply: AppleEvent;
  19.                                     myRefCon: LONGINT): OSErr;
  20. implementation
  21.     uses
  22.         Globals;
  23.     function RequiredCheck (theAppleEvent: AppleEvent): OSErr;
  24.         var
  25.             myErr: OSErr;
  26.             typeCode: DescType;
  27.             actualSize: Size;
  28.             sourceOfAE: integer;
  29.     begin
  30.         sourceOfAE := 0;
  31.         myErr := AEGetAttributePtr(theAppleEvent, keyMissedKeywordAttr, typeWildCard, typeCode, nil, 0, actualSize);
  32.         RequiredCheck := myErr;
  33.         if myErr = errAEDescNotFound then
  34.             begin
  35.                 RequiredCheck := noErr;
  36.             end
  37.         else if myErr = noErr then
  38.             begin
  39.                 RequiredCheck := errAEEventNotHandled;
  40.             end;
  41.     end;
  42.     function HandleOApp (theAppleEvent: AppleEvent;
  43.                                     reply: AppleEvent;
  44.                                     myRefCon: LONGINT): OSErr;
  45.  
  46.     begin
  47.         HandleOApp := RequiredCheck(theAppleEvent);
  48.     end;
  49.     function HandlePDOC (theAppleEvent: AppleEvent;
  50.                                     reply: AppleEvent;
  51.                                     myRefCon: LONGINT): OSErr;
  52.     begin
  53.         HandlePDOC := errAEEventNotHandled;
  54.     end;
  55.  
  56.     function HandleODoc (theAppleEvent: AppleEvent;
  57.                                     reply: AppleEvent;
  58.                                     myRefCon: LONGINT): OSErr;
  59.     begin
  60.         HandleODoc := errAEEventNotHandled;
  61.     end;
  62.  
  63.     function HandleQuit (theAppleEvent: AppleEvent;
  64.                                     reply: AppleEvent;
  65.                                     myRefCon: LONGINT): OSErr;
  66.         var
  67.             myErr: OSErr;
  68.     begin
  69.         myErr := RequiredCheck(theAppleEvent);
  70.         if myErr = noErr then
  71.             gDone := TRUE;
  72.         HandleQuit := myErr;
  73.     end;
  74. end.